
package coop.bancocredicoop.proyectos.gd.alfresco

import coop.bancocredicoop.proyectos.gd.alfresco.AlfrescoHttpClient

import org.apache.commons.logging.LogFactory

import org.apache.http.impl.client.BasicCookieStore
import org.apache.http.impl.client.HttpClients

class AlfrescoHttpClientWithExplorer extends AlfrescoHttpClient {
    
    private static final log = LogFactory.getLog(this)
    def user

    AlfrescoHttpClientWithExplorer(alfrescoConfig, user) {
        super(alfrescoConfig)
        this.user = user
    }

    def beforeGet(httpClient, httpGet) {
        setUserInHeader(httpGet)
    }

    def beforePost(httpPost) {
        setUserInHeader(httpPost)
    }

    private def setUserInHeader(request) {
        request.setHeader("X-Alfresco-Remote-User", user)
    }

}

